void FixupAngleDifference(usercmd_t *cmd);
usercmd_t g_Originalcmd;

void posthook_CL_CreateMove(usercmd_t *cmd)
{
// copy the original cmd structure for reference after it has been changed by the aimbot/other hacks
memcpy(&g_Originalcmd, cmd, sizeof(usercmd_t));

FixupAngleDifference(cmd);
}

void FixupAngleDifference(usercmd_t *cmd)
{
// thanks tetsuo for this copy/paste
cl_entity_t *pLocal;
Vector viewforward, viewright, viewup, aimforward, aimright, aimup, vTemp;
float newforward, newright, newup, newmagnitude, fTime;
float forward = g_Originalcmd.forwardmove;
float right = g_Originalcmd.sidemove;
float up = g_Originalcmd.upmove;

pLocal = gEngfuncs.GetLocalPlayer();
if(!pLocal)
return;

// this branch makes sure your horizontal velocity is not affected when fixing up the movement angles -- it isn't specific to spinning and you can use it with the source tetsuo posted in his forum too
if(pLocal->curstate.movetype == MOVETYPE_WALK)
{
gEngfuncs.pfnAngleVectors(Vector(0.0f, g_Originalcmd.viewangles.y, 0.0f), viewforward, viewright, viewup);
}
else
{
gEngfuncs.pfnAngleVectors(g_Originalcmd.viewangles, viewforward, viewright, viewup);
}

// SPIN!!!
int iHasShiftHeld = GetAsyncKeyState(VK_LSHIFT);
if(pLocal->curstate.movetype == MOVETYPE_WALK && !iHasShiftHeld && !(cmd->buttons & IN_ATTACK) && !(cmd->buttons & IN_USE) && (currentWeaponID!=WEAPON_HE && currentWeaponID!=WEAPON_FLASH && currentWeaponID!=WEAPON_SMOKE && currentWeaponID!=WEAPON_KNIFE))
{

cvar.nospread=2;

if(cvar.spin==1){

fTime = gEngfuncs.GetClientTime();
cmd->viewangles.y = fmod(fTime * cvar.spinrevs * 360.0f, 360.0f);}

if(cvar.spin==2){

fTime = gEngfuncs.GetClientTime();
#define M_PI 3.1415926
cmd->viewangles.x = cos(fTime * cvar.spinrevs * M_PI) * 90.0f;
cmd->viewangles.y = sin(fTime * cvar.spinrevs * 360.0f) * 360.0f;
}
}

else{

cvar.nospread = 1;

}

// this branch makes sure your horizontal velocity is not affected when fixing up the movement angles -- it isn't specific to spinning and you can use it with the source tetsuo posted in his forum too
if(pLocal->curstate.movetype == MOVETYPE_WALK)
{
gEngfuncs.pfnAngleVectors(Vector(0.0f, cmd->viewangles.y, 0.0f), aimforward, aimright, aimup);
}
else
{
gEngfuncs.pfnAngleVectors(cmd->viewangles, aimforward, aimright, aimup);
}

newforward = DotProduct(forward * viewforward.Normalize(), aimforward) + DotProduct(right * viewright.Normalize(), aimforward) + DotProduct(up * viewup.Normalize(), aimforward);
newright = DotProduct(forward * viewforward.Normalize(), aimright) + DotProduct(right * viewright.Normalize(), aimright) + DotProduct(up * viewup.Normalize(), aimright);
newup = DotProduct(forward * viewforward.Normalize(), aimup) + DotProduct(right * viewright.Normalize(), aimup) + DotProduct(up * viewup.Normalize(), aimup);

cmd->forwardmove = newforward;
cmd->sidemove = newright;
cmd->upmove = newup;
}



Add this above Cl_creatmove();

Now in cvar.h

go all the way down and add this
Code:

int spin;
float spinrevs;


Go to cvar.cpp

go to the end of the REGISTER_CVAR_FLOAT

Add this
Code:

REGISTER_CVAR_INT( spin, 0)
REGISTER_CVAR_FLOAT( spinrevs, 0.00)


Now go back to client.cpp

Add this in Cl_createmove();

Code:
Code:

if(cvar.spin==1 || cvar.spin==2){
posthook_CL_CreateMove(usercmd);

}



Spin 1 is regular spin
Spin 2 is Vertical spin

Now most Aimbots work by setting the view angles.

Here is a fix that will allow you to use spin without comprimising your aimbot.

Search for
Code:

if (gAimbot.target != -1 && me.iClip && me.pmMoveType != 5 && cvar.aim)

Replace the entire if statement with this

Code:

if (gAimbot.target != -1 && me.iClip && me.pmMoveType != 5 && cvar.aim)
{

if(cvar.spin == 1 || cvar.spin==2){
usercmd_t *cmd;
if((cmd->buttons & IN_ATTACK)){

VectorCopy ( gAimbot.aim_viewangles, usercmd->viewangles );
gEngfuncs.SetViewAngles ( gAimbot.aim_viewangles);

}

else {

}

}

else{

VectorCopy ( gAimbot.aim_viewangles, usercmd->viewangles );
gEngfuncs.SetViewAngles ( gAimbot.aim_viewangles);

}

}

credit:horndog?